Repository navigation
fix(files_sharing): encode path in public share download redirect - #65983
Conversation
|
Hi, friendly ping: could someone from the team take a look at this when there's time? CI is green except for the usual unrelated checks. Thanks! |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Mario Alfonso Pym Mejía <pymm@hitss.com>
55450ee to
2556b54
Compare
Summary
The legacy public share download endpoint (
/s/{token}/download?path=...and?files=<name>) redirects to the public WebDAV URL by appending the requested node's relative path unencoded. Consequently, folder or file names containing reserved URL characters break the redirect:#truncates the path into a URL fragment (e.g., downloadinga#bresults in/public.php/dav/files/<token>/a#b?accept=zip, causing the client to request/aand fail with a 404).?or%cause similar malformed URLs.This fix encodes the path segment by segment using
OCP\Util::encodePath()prior to generating the redirect, leaving names without special characters unaffected.How to test
sharedwith a subfoldera#bcontaining a file, and sharesharedby public link./index.php/s/<token>/download?path=/a%23b.Location: .../public.php/dav/files/<token>/a#b?accept=zip→ 404.After:
Location: .../public.php/dav/files/<token>/a%23b?accept=zip→ 200, zip witha#b/x.txt.Checklist
3. to review, feature component)stable32)AI (if applicable)